/*     */ package com.zimbra.cs.mime;
/*     */ 
/*     */ import com.zimbra.cs.store.Blob;
/*     */ import java.io.File;
/*     */ import java.io.IOException;
/*     */ import javax.mail.internet.MimeMessage;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class ParsedMessageOptions
/*     */ {
/*     */   private MimeMessage mMimeMessage;
/*     */   private byte[] mRawData;
/*     */   private File mFile;
/*     */   private String mRawDigest;
/*     */   private Long mRawSize;
/*     */   private Long mReceivedDate;
/*     */   private Boolean mIndexAttachments;
/*     */   
/*     */   public ParsedMessageOptions() {}
/*     */   
/*     */   public ParsedMessageOptions(Blob blob, byte[] buffer)
/*     */     throws IOException
/*     */   {
/*  41 */     this(blob, buffer, null, null);
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions(Blob blob, byte[] buffer, Long receivedDate, Boolean indexAttachments) throws IOException
/*     */   {
/*  46 */     if (buffer == null) {
/*  47 */       setContent(blob.getFile());
/*     */     } else
/*  49 */       setContent(buffer);
/*  50 */     setDigest(blob.getDigest()).setSize(blob.getRawSize());
/*  51 */     if (receivedDate != null)
/*  52 */       setReceivedDate(receivedDate.longValue());
/*  53 */     if (indexAttachments != null)
/*  54 */       setAttachmentIndexing(indexAttachments.booleanValue());
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions setContent(MimeMessage mimeMessage) {
/*  58 */     if ((this.mRawData != null) || (this.mFile != null)) {
/*  59 */       throw new IllegalArgumentException("Content can only come from one source.");
/*     */     }
/*  61 */     this.mMimeMessage = mimeMessage;
/*  62 */     return this;
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions setContent(byte[] rawData) {
/*  66 */     if ((this.mMimeMessage != null) || (this.mFile != null)) {
/*  67 */       throw new IllegalArgumentException("Content can only come from one source.");
/*     */     }
/*  69 */     this.mRawData = rawData;
/*  70 */     return this;
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions setContent(File file) {
/*  74 */     if ((this.mRawData != null) || (this.mMimeMessage != null)) {
/*  75 */       throw new IllegalArgumentException("Content can only come from one source.");
/*     */     }
/*  77 */     this.mFile = file;
/*  78 */     return this;
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions setDigest(String digest) {
/*  82 */     this.mRawDigest = digest;
/*  83 */     return this;
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions setSize(long size) {
/*  87 */     this.mRawSize = Long.valueOf(size);
/*  88 */     return this;
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions setReceivedDate(long receivedDate) {
/*  92 */     this.mReceivedDate = Long.valueOf(receivedDate);
/*  93 */     return this;
/*     */   }
/*     */   
/*     */   public ParsedMessageOptions setAttachmentIndexing(boolean enabled) {
/*  97 */     this.mIndexAttachments = Boolean.valueOf(enabled);
/*  98 */     return this;
/*     */   }
/*     */   
/* 101 */   public MimeMessage getMimeMessage() { return this.mMimeMessage; }
/* 102 */   public byte[] getRawData() { return this.mRawData; }
/* 103 */   public File getFile() { return this.mFile; }
/* 104 */   public String getDigest() { return this.mRawDigest; }
/* 105 */   public Long getSize() { return this.mRawSize; }
/* 106 */   public Long getReceivedDate() { return this.mReceivedDate; }
/* 107 */   public Boolean getAttachmentIndexing() { return this.mIndexAttachments; }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mime/ParsedMessageOptions.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */